﻿
@{
    ViewBag.Title = "employee_leave";
    Layout = "~/Views/Shared/Index.cshtml";
}

@model List<YaYun.Models.employee_leave>

<h2>员工请假表</h2>

<table class="layui-table layui-form">
    <tr>
        <th class="emp_id_td">序号</th>
        <th class="emp_tr_t">员工编号</th>
        <th class="emp_tr_t">请假开始日期</th>
        <th class="emp_tr_t">请假结束日期</th>
        <th class="emp_tr_t">请假理由</th>
        <th class="emp_tr_t">请假类型 </th>
        <th class="emp_tr_t">是否已批准</th>
        <th class="emp_tr_t">是谁批准的</th>
        <th class="emp_tr_t">意见</th>
        <th class="emp_tr_t">记录创建时间</th>
        <th class="emp_tr_t">最后一次更新时间</th>
    </tr>
    @foreach (var item in Model)
    {
        <tr class="tr_hover">
            <td class="emp_id_td">@item.id</td>
            <td class="emp_tr_t">@item.Employee.EmployeeName</td>
            <td class="emp_tr_t">@item.leave_start_date</td>
            <td class="emp_tr_t">@item.leave_end_date</td>
            <td class="emp_tr_t">@item.leave_reason</td>
            <td class="emp_tr_t">@item.leave_type</td>
            <td class="emp_tr_t">@(item.is_approved==false?"未批准":"已批准")</td>
            <td class="emp_tr_t">@item.approved_by</td>
            <td class="emp_tr_t">@item.comment</td>
            <td class="emp_tr_t">@item.created_at</td>
            <td class="emp_tr_t">@item.updated_at</td>

        </tr>
    }
</table>


<div class="demo-laypage-pn-show">
    @Html.ActionLink("上一页", "employee_leave", new { page = ViewBag.CurrentPage - 1 }, new { @class = "layui-btn" })
    @for (int i = 1; i <= ViewBag.TotalPages; i++)
    {
        if (i == ViewBag.CurrentPage)
        {
            @Html.Label($"{@i}", new { @class = "layui-btn layui-btn-sm layui-btn-warm" }) ;
        }
        else
        {
            @Html.ActionLink(i.ToString(), "employee_leave", new { page = i }, new { @class = "layui-btn layui-btn-primary layui-btn-sm" });
        }
    }
    @Html.ActionLink("下一页", "employee_leave", new { page = ViewBag.CurrentPage + 1 }, new { @class = "layui-btn" })
</div>